<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Key generation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Key_generation"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Key_generation rootpage-Key_generation skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Key generation</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p><b>Key generation</b> is the process of generating keys in <a href="Cryptography" title="Cryptography">cryptography</a>. A key is used to encrypt and decrypt whatever data is being encrypted/decrypted.
</p><p>A device or program used to generate keys is called a key generator or <a href="Key_generator" title="Key generator">keygen</a>.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Generation_in_cryptography">Generation in cryptography</h2></div>
<p>Modern cryptographic systems include <a href="Symmetric-key_algorithm" title="Symmetric-key algorithm">symmetric-key algorithms</a> (such as <a href="Data_Encryption_Standard" title="Data Encryption Standard">DES</a> and <a href="Advanced_Encryption_Standard" title="Advanced Encryption Standard">AES</a>) and <a href="Public-key_cryptography" title="Public-key cryptography">public-key algorithms</a> (such as <a href="RSA_(algorithm)" class="mw-redirect" title="RSA (algorithm)">RSA</a>). Symmetric-key algorithms use a single shared key; keeping data secret requires keeping this key secret. Public-key algorithms use a <a href="Public_key" class="mw-redirect" title="Public key">public key</a> and a <a href="Private_key" class="mw-redirect" title="Private key">private key</a>. The public key is made available to anyone (often by means of a <a href="Digital_certificate" class="mw-redirect" title="Digital certificate">digital certificate</a>). A sender encrypts data with the receiver's public key; only the holder of the private key can decrypt this data.
</p><p>Since public-key algorithms tend to be much slower than symmetric-key algorithms, modern systems such as <a href="Transport_Layer_Security" title="Transport Layer Security">TLS</a> and <a href="Secure_Shell" title="Secure Shell">SSH</a> use a combination of the two: one party receives the other's public key, and encrypts a small piece of data (either a symmetric key or some data used to generate it). The remainder of the conversation uses a (typically faster) symmetric-key algorithm for encryption.
</p><p>Computer cryptography uses <a href="Integer" title="Integer">integers</a> for keys. In some cases, keys are randomly generated using a <i><a href="Random_number_generator" class="mw-redirect" title="Random number generator">random number generator</a> (RNG)</i> or <i><a href="Pseudorandom_number_generator" title="Pseudorandom number generator">pseudorandom number generator</a> (PRNG)</i>. A PRNG is a <a href="Computer" title="Computer">computer</a> <a href="Algorithm" title="Algorithm">algorithm</a> that produces data that appears random under analysis. PRNGs that use system entropy to <a href="Random_seed" title="Random seed">seed</a> data generally produce better results, since this makes the initial conditions of the PRNG much more difficult for an attacker to guess. Another way to generate randomness is to utilize information outside the system. <a href="Veracrypt" class="mw-redirect" title="Veracrypt">Veracrypt</a> (a disk encryption software) utilizes user mouse movements to generate unique seeds, in which users are encouraged to move their mouse sporadically.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> In other situations, the key is derived deterministically using a <a href="Passphrase" title="Passphrase">passphrase</a> and a <a href="Key_derivation_function" title="Key derivation function">key derivation function</a>.
</p><p>Many modern protocols are designed to have <a href="Forward_secrecy" title="Forward secrecy">forward secrecy</a>, which requires generating a fresh new shared key for each session.
</p><p>Classic cryptosystems invariably generate two identical keys at one end of the communication link and somehow transport one of the keys to the other end of the link. However, it simplifies <a href="Key_management" title="Key management">key management</a> to use <a href="Diffie%E2%80%93Hellman_key_exchange" title="Diffie–Hellman key exchange">Diffie–Hellman key exchange</a> instead.
</p><p>The simplest method to read encrypted data without actually decrypting it is a <a href="Brute-force_attack" title="Brute-force attack">brute-force attack</a>—simply attempting every number, up to the maximum length of the key. Therefore, it is important to use a sufficiently long <a href="Key_length" class="mw-redirect" title="Key length">key length</a>; longer keys take exponentially longer to attack, rendering a brute-force attack impractical. Currently, key lengths of <a href="128-bit" class="mw-redirect" title="128-bit">128 bits</a> (for symmetric key algorithms) and 2048 bits (for public-key algorithms) are common.
</p>
<div class="mw-heading mw-heading2"><h2 id="Generation_in_physical_layer">Generation in physical layer</h2></div>
<div class="mw-heading mw-heading3"><h3 id="Wireless_channels">Wireless channels</h3></div>
<p>A wireless channel is characterized by its two end users. By transmitting pilot signals, these two users can estimate the channel between them and use the channel information to generate a key which is secret only to them.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> The common secret key for a group of users can be generated based on the channel of each pair of users.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Optical_fiber">Optical fiber</h3></div>
<p>A key can also be generated by exploiting the phase fluctuation in a fiber link.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Distributed_key_generation" title="Distributed key generation">Distributed key generation</a>: For some protocols, no party should be in the sole possession of the secret key. Rather, during <i>distributed key generation</i>, every party obtains a <a href="Secret_sharing" title="Secret sharing">share</a> of the key. A <a href="Threshold_cryptosystem" title="Threshold cryptosystem">threshold</a> of the participating parties need to cooperate to achieve a cryptographic task, such as decrypting a message.</li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://veracrypt.eu/en/Random%20Number%20Generator.html">"VeraCrypt - Random Number Generator"</a>. <i>veracrypt.eu</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2025-05-14</span></span>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><cite id="CITEREFChan_Dai_Truyen_ThaiJemin_LeeTony_Q._S._Quek2016" class="citation journal cs1">Chan Dai Truyen Thai; Jemin Lee; Tony Q. S. Quek (Feb 2016). "Physical-Layer Secret Key Generation with Colluding Untrusted Relays". <i>IEEE Transactions on Wireless Communications</i>. <b>15</b> (2): <span class="nowrap">1517–</span>1530. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1109%2FTWC.2015.2491935">10.1109/TWC.2015.2491935</a>. <a href="S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:27603548">27603548</a>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite id="CITEREFChan_Dai_Truyen_ThaiJemin_LeeTony_Q._S._Quek2015" class="citation conference cs1">Chan Dai Truyen Thai; Jemin Lee; Tony Q. S. Quek (Dec 2015). "Secret Group Key Generation in Physical Layer for Mesh Topology". <i>2015 IEEE Global Communications Conference (GLOBECOM)</i>. San Diego. pp. <span class="nowrap">1–</span>6. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1109%2FGLOCOM.2015.7417477">10.1109/GLOCOM.2015.7417477</a>.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><cite id="CITEREFZamanLopezFaruqueBoyraz2018" class="citation journal cs1">Zaman, Imam Uz; Lopez, Anthony Bahadir; Faruque, Mohammad Abdullah Al; Boyraz, Ozdal (2018-12-15). <a rel="nofollow" class="external text" href="https://dx.doi.org/10.1109/jlt.2018.2880957">"Physical Layer Cryptographic Key Generation by Exploiting PMD of an Optical Fiber Link"</a>. <i>Journal of Lightwave Technology</i>. <b>36</b> (24): <span class="nowrap">5903–</span>5911. <a href="Bibcode_(identifier)" class="mw-redirect" title="Bibcode (identifier)">Bibcode</a>:<a rel="nofollow" class="external text" href="https://ui.adsabs.harvard.edu/abs/2018JLwT...36.5903Z">2018JLwT...36.5903Z</a>. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1109%2Fjlt.2018.2880957">10.1109/jlt.2018.2880957</a>. <a href="ISSN_(identifier)" class="mw-redirect" title="ISSN (identifier)">ISSN</a> <a rel="nofollow" class="external text" href="https://search.worldcat.org/issn/0733-8724">0733-8724</a>. <a href="PMC_(identifier)" class="mw-redirect" title="PMC (identifier)">PMC</a> <span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6350795">6350795</a></span>. <a href="PMID_(identifier)" class="mw-redirect" title="PMID (identifier)">PMID</a> <a rel="nofollow" class="external text" href="https://pubmed.ncbi.nlm.nih.gov/30713365">30713365</a>.</cite></span>
</li>
</ol></div></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-05-19" href="https://en.wikipedia.org/wiki/?title=Key_generation&oldid=1291110046">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>